package com.snack.web.action.user;

import org.apache.log4j.Logger;

import com.lamfire.wkit.action.ActionForward;

import com.snack.dao.UserDAO;
import com.snack.dao.impl.UserDAOImpl;
import com.snack.entity.User;
import com.snack.web.action.AbstractAction;

public class AddAction extends AbstractAction {
	private Logger log = Logger.getLogger(AddAction.class);
	private int id;
	private String name;
	private String password;
	
	@Override
	public ActionForward execute() {
		log.info("fuck all");
		log.error("error fuck all");
		UserDAO dao = new UserDAOImpl();
		User user = new User();
		user.setName(name);
		user.setPassword(password);
		id = dao.save(user);
		dao.update(user);
		return forward("/WEB-INF/page/info.jsp");
	}

	
	public int getId() {
		return id;
	}


	public void setName(String name) {
		this.name = name;
	}

	public void setPassword(String password) {
		this.password = password;
	}
	
}
